Washington -LRB- CNN -RRB- -- In the most extensive reshaping of the Obama administration 's national security team to date , the president will name Central Intelligence Agency Director Leon Panetta as his nominee to succeed Robert Gates as defense secretary , top U.S. officials said Wednesday .

Gen. David Petraeus will be nominated to take over as CIA director , and Lt. Gen. John Allen will succeed Petraeus as head of the U.S-led international military force in Afghanistan , a senior administration official told reporters . In addition , longtime diplomat Ryan Crocker will be nominated as the next U.S. ambassador to Afghanistan , the official said .

President Barack Obama will formally announce the changes on Thursday , according to the senior administration official . It is the biggest reshaping of Obama 's national security team since he took office in January 2009 and reflects a longstanding plan by Gates to step aside this year .

More changes also are coming . Both Adm. Mike Mullen , chairman of the Joint Chiefs of Staff , and FBI Director Robert Mueller are not eligible for renomination for terms that expire this year .

Gates will resign effective June 30 , assuming Panetta gets confirmed by Congress in time and is ready to start on July 1 , according to an administration official and a congressional aide familiar with phone calls Gates was making to legislators and senior staff members .

Petraeus will remain in command in Afghanistan until Allen is ready to take over at the beginning of September , officials said , which could require an interim CIA director if Panetta moves to the defense secretary 's office as planned on July 1 .

In addition , Petraeus will resign from the military once confirmed so that he serves as a civilian CIA director , officials said .

Initial reaction from Congress was positive , with key legislators on intelligence and security issues praising both Panetta and Petraeus as good choices .

`` The sum total of these picks is that the president has chosen experienced people with unique capabilities to serve our nation at a dangerous time , '' said Republican Sen. Lindsey Graham of South Carolina . `` This team will provide the leadership to help make our nation safer . I could not be more pleased with these selections . I hope these nominees receive swift approval by the United States Senate . ''

Gates was telling legislators and staff members that he recommended Panetta for his job six months ago , and joked that Panetta stopped speaking to him for days for doing so , the officials said . In addition , Gates was saying that Allen was a consensus choice to succeed Petraeus , according to the officials .

It took a meeting with Obama to convince Panetta to accept the job , a source familiar with the discussions told CNN . Panetta has been happy serving at the CIA , but `` believes strongly in public service and answering the call from the commander-in-chief , '' the source said .

Panetta , 72 , took over at the CIA in February 2009 . He served as chief of staff to President Bill Clinton between 1994 and 1997 , and was previously the director of the Office of Management and Budget -LRB- OMB -RRB- . The California Democrat served in the House of Representatives from 1977 to 1993 .

Before coming to the CIA , he spent 10 years co-directing a public policy institute with his wife , Sylvia .

He was brought in as a relative outsider , without hands-on intelligence experience , to manage an agency that had been shaken by the exposure and criticism of its controversial interrogation and detention program . Panetta 's longstanding ties to Congress were seen as a way to restore the administration 's relationship with oversight committees . He has been given high marks on both fronts from inside the agency and in Congress .

David Berteau , a senior adviser at the Center for Strategic and International Studies , said Panetta brings several important qualities to the table .

He `` learned a lot of lessons '' about defense budgeting during his stint as the head of the OMB , and knows how to deal with a Republican Congress , as he did during the Clinton administration , Berteau said .

Panetta 's former congressional district in northern California had a huge defense presence , Berteau said .

Panetta has earned the trust and confidence of Obama as leader of the CIA , and has name recognition , which is important , Berteau said , adding : `` It 's a name Americans recognize . Filling Bob Gates ' shoes is really going to be a tough job . ''

Berteau said the president 's choice of Petraeus to lead the CIA indicates that Obama is interested in his national security views and efforts and it `` indicates that the president cares about the way all those pieces fit together . ''

Earlier this month , Petraeus took a highly unusual step for a military officer when he publicly acknowledged the possibility of being in contention for a presidential appointment .

`` It 's probably not appropriate for me to comment on whatever might be considered down the road , '' he told reporters in Kabul when asked about the possible CIA nomination . `` I 've had discussions , but again , it would n't be appropriate to comment . ''

Petraeus , 58 , assumed command of the NATO International Security Assistance Force -LRB- ISAF -RRB- and U.S. Forces Afghanistan on July 4 , 2010 , after serving for more than 20 months as commander of United States Central Command . He previously commanded multi-national forces in Iraq , leading the so-called `` surge . '' During his time commanding the U.S. Army Combined Arms Center and Fort Leavenworth , he oversaw the development of the Army/Marine Corps Counterinsurgency Manual .

Crocker has served previously as U.S. ambassador to Iraq and to Pakistan , while Allen became deputy commander of U.S. Central Command in July 2008 .

Gates is the only Cabinet member from the previous administration to stay on when Obama came into office . President George W. Bush nominated Gates as the nation 's 22nd secretary of defense in December 2006 to replace Donald Rumsfeld , one of the architects of the Iraq War who was facing widespread criticism .

Gates did not expect to stay on after Bush 's presidency ended . When asked if he would continue under another administration , Gates said in 2008 , `` I learned a long time ago never to say never , so my answer is : The circumstances under which I would do that are inconceivable to me . ''

But those circumstances arose . In December 2008 , then-President-elect Obama expressed a desire for continuity at the Pentagon , given the ongoing conflicts abroad in Iraq and Afghanistan .

`` I spent a long time hoping the question would never be popped , '' Gates admitted the day after Obama announced his nomination . But , he said , Obama `` impressed '' him .

It is unclear who may replace Mueller at the FBI .

Attorney General Eric Holder on Tuesday did not rule out Mueller staying on short-term when his 10-year term expires in September if a successor has not yet been confirmed . Mueller will leave `` hard shoes to fill , '' Holder said .

Holder said he has been discussing potential nominees with White House officials , including Vice President Joe Biden . Holder said he believes that if a nominee is selected by May , the administration should have time to get the new director confirmed by August .

If that timeline slips , however , the Mueller term would end September 4 , one week before the 10th anniversary of the 9/11 terrorist attacks on the World Trade Center and the Pentagon . Mueller has often remarked that he barely had a chance to find his desk before the 9/11 attacks occurred , and his entire decade was dominated by the fight against al Qaeda and its scattered supporters at home and abroad .

CNN 's Barbara Starr , Joe Sterling , Terry Frieden , Tom Cohen , John King and Chris Lawrence contributed to this report .

@highlight

NEW : Petraeus to resign from military once confirmed , sources say

@highlight

It took a meeting with Obama to convince Panetta to take the job , a source says

@highlight

Petraeus will be nominated as CIA chief

@highlight

It is the most extensive reshaping of Obama 's national security team to date